package cn.test.controller;

import java.util.HashSet;

import javax.servlet.http.HttpServletRequest;

import lombok.extern.slf4j.Slf4j;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author summit
 * @since 2022/4/13 14:40
 */
@RestController
@Slf4j

public class XingYeController {

	@GetMapping(value = "/api/cas/v3/sys/token/auth", produces = "application/json")
	public String result(HttpServletRequest httpServletRequest) {

		log.info("param=> {}", httpServletRequest.getParameterMap());


		if (httpServletRequest.getParameter("oa_token").startsWith("2")) {
			return "{\n"
					+ "\t\"resphead\": {\n"
					+ "\t\t\"msg\": \"操作成功\",\n"
					+ "\t\t\"code\": 200,\n"
					+ "\t\t\"success\": true\n"
					+ "\t},\n"
					+ "\t\"respbody\": {\n"
					+ "\t\t\"data\": {\n"
					+ "\t\t\t\"organizationId\": \"5378\",\n"
					+ "\t\t\t\"loginId\": \"12345\",\n"
					+ "\t\t\t\"organizationName\": \"金融科技部\",\n"
					+ "\t\t\t\"hrid\": \"62584\",\n"
					+ "\t\t\t\"sex\": \"男\",\n"
					+ "\t\t\t\"corp_eml\": \"chenxiangkai@xyzq.com.cn\",\n"
					+ "\t\t\t\"recStatus\": \"1\",\n"
					+ "\t\t\t\"userName\": \"陈祥凯\",\n"
					+ "\t\t\t\"eMail\": \"chenxiangkai@xyzq.com.cn\"\n"
					+ "\t\t}\n"
					+ "\t}\n"
					+ "}";
		}


		if (httpServletRequest.getParameter("oa_token").startsWith("3")) {
			return "{\n"
					+ "\t\"resphead\": {\n"
					+ "\t\t\"msg\": \"操作成功\",\n"
					+ "\t\t\"code\": 200,\n"
					+ "\t\t\"success\": false\n"
					+ "\t},\n"
					+ "\t\"respbody\": {}\n"
					+ "}";
		}

		if (httpServletRequest.getParameter("oa_token").startsWith("4")) {
			return "{\n"
					+ "\t\"resphead\": {\n"
					+ "\t\t\"msg\": \"操作成功\",\n"
					+ "\t\t\"code\": 200,\n"
					+ "\t\t\"success\": false\n"
					+ "\t}\n"
					+ "}";
		}

		return "{\n"
				+ "\t\"resphead\": {\n"
				+ "\t\t\"msg\": \"操作成功\",\n"
				+ "\t\t\"code\": 200,\n"
				+ "\t\t\"success\": true\n"
				+ "\t},\n"
				+ "\t\"respbody\": {\n"
				+ "\t\t\"data\": {\n"
				+ "\t\t\t\"organizationId\": \"5378\",\n"
				+ "\t\t\t\"loginId\": \"admin\",\n"
				+ "\t\t\t\"organizationName\": \"金融科技部\",\n"
				+ "\t\t\t\"hrid\": \"62584\",\n"
				+ "\t\t\t\"sex\": \"男\",\n"
				+ "\t\t\t\"corp_eml\": \"chenxiangkai@xyzq.com.cn\",\n"
				+ "\t\t\t\"recStatus\": \"1\",\n"
				+ "\t\t\t\"userName\": \"陈祥凯\",\n"
				+ "\t\t\t\"eMail\": \"chenxiangkai@xyzq.com.cn\"\n"
				+ "\t\t}\n"
				+ "\t}\n"
				+ "}";
	}
}
